const mongoose = require('mongoose')

const { Schema, model } = mongoose

// 通过 schema 设计出表结构，简单结构复杂结构都可以，每一条自动创建 _id
const userSchema = new Schema({
  name: {
    type: String,
    required: true // 必要
  },
  user: {
    type: String,
    required: true // 必要
  },
  password: {
    type: String,
    required: true
  },
  avatar: {
    type: String,
  },
})

// User 表
module.exports = model('User', userSchema)
